package MyAdmin.Controller;

import MyFramePro.Domain.ResponseResult;
import MyFramePro.Domain.Vo.BehindUserVo;
import MyFramePro.Service.Impl.UserServiceImpl;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping(value = "/system/user")
public class SystemUserController {

    @Resource
    private UserServiceImpl userService;

    /**
     * 这里是查询用户列表的功能
     */
    @GetMapping(value = "/list")
    public ResponseResult selectUserList(Integer pageNum,Integer pageSize,String userName,String phonenumber,String status){

        return userService.selectUserList(pageNum,pageSize,userName,phonenumber,status);
    }

    /**
     * 这里是新增用户的功能
     */
    @PostMapping
    public ResponseResult addUser(@RequestBody BehindUserVo behindUserVo){

        return userService.addUser(behindUserVo);
    }


    /**
     * 这里是删除用户的功能
     */
    @DeleteMapping("{id}")
    public ResponseResult deleteUser(@PathVariable("id") Long id){

        return userService.deleteUser(id);
    }


    /**
     * 这里是修改用户的功能————回显信息
     */
    @GetMapping("{id}")
    public ResponseResult showUpateUserInfo(@PathVariable("id") Long id){

        return userService.showUpateUserInfo(id);
    }


    /**
     * 这里是修改用户的功能
     */
    @PutMapping
    public ResponseResult updateUser(@RequestBody BehindUserVo behindUserVo){

        return userService.updateUser(behindUserVo);
    }


}
